package com.aceitunaproject.client.mapscreen;
import javax.swing.JPanel;
import com.aceitunaproject.mapdisplay.MapDrawer;
import java.awt.Graphics;
import java.awt.Graphics2D;

/**
 * 
 * @author Federico Bergstein
 *
 * A simple class to display the map  
 */
public class MapPane extends JPanel {


	private static final long serialVersionUID = 1L;

	private MapDrawer mapDrawer;
	
	
	/**
	 * Sets the map drawer object to use to display the map
	 * @param mapDrawer
	 * 	the map drawer object to use to display the map
	 */
	public void setMapDrawer(MapDrawer mapDrawer) {
		this.mapDrawer = mapDrawer;
	}

	@Override
	public void paintComponent(Graphics g) {

		Graphics2D g2d = (Graphics2D) g;
		if (mapDrawer != null) {

			mapDrawer.display(g2d);

		}
	}
}
